<template>
  <el-card class="box-card">
    <div slot="header" class="clearfix">
      <span>修改班级</span>
      <el-button style="float: right; padding: 3px 0" type="text" @click="handleClick">确认修改</el-button>
    </div>
    <div>
      <template>
        <el-select v-model="value" placeholder="请选择">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </template>
    </div>
  </el-card>
</template>

<script>
  import { UpdateStudentInfo } from '../../api/personal'
  import { getInfo } from '@/api/user'
export default {
  data() {
    return {
      options: [{
        value: '1701',
        label: '1701'
      }, {
        value: '1702',
        label: '1702'
      }, {
        value: '1703',
        label: '1703'
      }],
      value: '',
      person: {
        studentNum: '',
        studentName: '',
        stuClass: ''
      }
    }
  },
  created() {
    this.getInfo()
  },
  methods: {
    getInfo() {
      getInfo().then(res => {
        this.person = res.data
        this.value = res.data.stuClass
      }).catch(err => {
        this.$message.error('请求失败！')
      })
    },
    handleClick(){
      UpdateStudentInfo({stuClass: this.value}).then(res=>{ this.$message.success('修改成功！')})
        .catch(err => {
          this.$message.error('请求失败！')
        })
    }

  }
}
</script>

<style scoped>

</style>
